<?php

namespace app\beautiful\model;

use app\beautiful\model\giftbag\GiftbagDetailModel;
use app\common\model\CommonModel;



class GiftbagModel extends CommonModel{

    protected  $name = 'beautiful_giftbag';

    protected  $pk   = 'giftbag_id';


    public function getAddTimeAttr($value,$data){

        return date('Y-m-d H:i',$data['add_time']);

    }

    public function getValidityTimeAttr($value,$data)

    {

        return [$data['valid_bg_time'],$data['valid_end_time']];

    }
    public function GiftbagDetail()

    {

        return $this->hasMany(GiftbagDetailModel::class,'giftbag_id','giftbag_id');

    }

}